package com.xw.mykotlin

import android.app.Application
import com.xw.kotlinlib.base.BaseViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn

class Main2ViewModel(application: Application): BaseViewModel(application) {

    private val mRepository = MainFlowRepository()

    fun getCategory(member_id: String?,build_type: Int?): Flow<List<PCategory>> {

        return flow {
            val data = mRepository.getCategory(member_id, build_type)
            emit(data)
        }.flowOn(Dispatchers.IO)
    }
}